const Router = require('koa-router');
const router = new Router();
const checkToken = require('../middlewares/checkToken');

// 业务路由
const user = require('../controllers/user');
const classify = require('../controllers/classify');
const Tag = require('../controllers/tag');
const Article = require('../controllers/article');

/**
 * user
 */
router.post('/login', user.login);
router.post('/createUser', checkToken.checkToken, user.createUser);
router.post('/findUserList', user.findUserList);
router.post('/deleteUser', checkToken.checkToken, user.deleteUser);
router.post('/getInfo', checkToken.checkToken, user.getInfo);

/**
 * classify
 */
router.post('/createClassify', checkToken.checkToken, classify.createClassify);
router.post('/findClassify', classify.findClassify);
router.post('/deleteClassify', checkToken.checkToken, classify.deleteClassify);
router.post('/updateClassify', checkToken.checkToken, classify.updateClassify);

/**
 * tag
 */
router.post('/createTag', checkToken.checkToken, Tag.createTag);
router.post('/findTag', Tag.findTag);
router.post('/deleteTag', checkToken.checkToken, Tag.deleteTag);
router.post('/updateTag', checkToken.checkToken, Tag.updateTag);

/**
 * 文章
 */
router.post('/createArticle', checkToken.checkToken, Article.createArticle);
router.post('/findArticleList', Article.findArticleList);
router.post('/deleteArticle', checkToken.checkToken, Article.deleteArticle);


module.exports = router;


